<?php
require_once 'Excel/reader.php';

// ExcelFile($filename, $encoding);
$data = new Spreadsheet_Excel_Reader();

// Set output Encoding.
$data->setOutputEncoding('CP1251');

$data->read('test.xls');

$arrList = array();
$index = 0;
$key = '';
for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
    $cell1 = $data->sheets[0]['cells'][$i][1];
    $cell2 = $data->sheets[0]['cells'][$i][2];
    $cell3 = $data->sheets[0]['cells'][$i][3];
    
    if ($cell2 == '' && $cell3 == '') {
        $key = $cell1;
        $index = 0;
    } else {
        $arrList[$key][$index]['product_name'] = $cell1;
        $arrList[$key][$index]['product_desc'] = $cell2;
        $arrList[$key][$index]['product_price'] = $cell3;
        
        $index++;
    }
}

print_r($arrList);die();
?>
